package Test6.BOOK;

import Test6.User.AdminUser;
import Test6.User.NormalUser;
import Test6.User.User;

import java.util.Scanner;

public class Main {
    public static User login(){//向上转型
        System.out.println("请输入你的姓名:");
        Scanner s= new Scanner(System.in);
        String name = s.nextLine();
        System.out.println("输入你的身份:1.管理员    2.用户");
        int choice = s.nextInt();
        if(choice==1){
            return new AdminUser(name);
        }else{
            return new NormalUser(name);
        }
    }



    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while(true) {
            int choice = user.menu();//根据返回值来执行对应操作
            user.Operation(choice, bookList);
        }
    }

}
